/*
package com.spsy.pay.controller;

import com.alipay.api.AlipayApiException;
import com.spsy.pay.utils.ZhifubaoUtill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/alipayExam")
public class AlipayExamController {

    @Autowired
    private ZhifubaoUtill zhifubaoUtill;

    @GetMapping("/pay/{orderId}")
    public String pay(HttpServletRequest request, @PathVariable String orderId) throws AlipayApiException {
        String html = (String) zhifubaoUtill.pay(orderId, "1").get("form");
        return html;
    }

    @GetMapping("/result")
    public String result(HttpServletRequest request) throws AlipayApiException {
        System.out.println("收到支付结果");
        String orderId = request.getParameter("out_trade_no");
        Boolean result = zhifubaoUtill.queryResult(orderId);
        System.out.println("订单编号："+orderId+",支付结果："+result);
        if(result == true){
            //TODO 修改订单状态为已支付
            return "SUCCESS";
        }else{
            return "FAIL";
        }

    }

    @GetMapping("/query/{orderId}")
    public Boolean query(HttpServletRequest request, @PathVariable String orderId) throws AlipayApiException {
        Boolean result = zhifubaoUtill.queryResult(orderId);
        return result;
    }
}
*/
